#include <iostream>
#include <limits>
using namespace std;

float atof(char *str){
	if(!str) return 0;
	bool pos=true;
	if(*str=='-'){
		pos=false;
		str++;
	}else if(*str=='+'){
		str++;
	}

	float result = 0;
	try{
		long long part1 = 0;
		while(*str!='\0'&&*str!='.'){
			if(*str>='0'&&*str<='9'){
				part1 = part1*10 + *str - '0';
				str++;
			}else if(*str!='\0'&&*str!='.'){
				throw "exception!";
			}
		}

		if(numeric_limits<float>::max()<part1)
			throw "overflow!";

		if(*str=='.'){
			str++;
			int tens = 0;
			long long part2 = 0;

			while(*str!='\0'){
				tens++;
				if(*str>='0'&&*str<='9'){
					part2 = part2*10 + *str - '0';
					str++;
				}else if(*str!='\0'){
					throw "exception!";
				}
			}

			if(numeric_limits<float>::max()<part2)
				throw "overflow!";

			int divident = 1;
			float part2tmp = (float)part2;
			for(int i=1;i<=tens;i++)
				divident*=10;
			result=(float)part1+part2tmp/divident;
		}
	}
	catch(char const *error){
		cout<<error<<endl;
		return 0;
	}

	return result;
}
